package application

import (
	"hong/uniapp_server/application/dto"

	"github.com/gofiber/fiber/v2"
	"github.com/rs/zerolog/log"
)

type LogController struct {
}

func NewLogController() *LogController {
	return &LogController{}
}

func (t *LogController) Log(c *fiber.Ctx) error {
	logRequest := new(dto.LogRequest)
	if err := c.BodyParser(logRequest); err != nil {
		log.Warn().Err(err).Msgf("log params error %v", err)
		return c.SendStatus(fiber.StatusNoContent)
	}
	log.Debug().Msgf("log request: %v", logRequest)
	return c.SendStatus(fiber.StatusOK)
}
